package com.zwan.oam_rtc.utils.messages;

import com.zwan.oam_rtc.utils.wintcp.ByteTransfer;

import java.nio.ByteBuffer;

public class NotifyIPTVResultMessage extends AbstractStruct {
    private byte[] messageBodyHeader = new byte[8];
    private byte[] callFlowId = new byte[20];
    private byte[] callStatus = new byte[4];
    private byte[] strresult = new byte[512];

    private static int LENGTH = 8+24+512;

    /**
     * 返回消息写入buffer
     */
    @Override
    public void writeToBuffer(ByteBuffer bf) {
        bf.put(messageBodyHeader);
        bf.put(callFlowId);
        bf.put(callStatus);
        bf.put(strresult);
    }

    /**
     * buffer读出返回消息
     */
    @Override
    public void readFromBuffer(ByteBuffer bf) {
        bf.get(messageBodyHeader);
        bf.get(callFlowId);
        bf.get(callStatus);
        bf.get(strresult);
    }

    public String getCallFlowId() {
        return ByteTransfer.getString(callFlowId);
    }

    public void setCallFlowId(String callFlowId) {
        ByteTransfer.str2Byte(callFlowId, this.callFlowId);
    }

    public String getStrresult() {
        return ByteTransfer.getString(strresult);
    }

    public void setStrresult(String strresult) {
        ByteTransfer.str2Byte(strresult, this.strresult);
    }

    public String getCallStatus() {
        return ByteTransfer.getString(callStatus);
    }

    public void setCallStatus(String callStatus) {
        ByteTransfer.str2Byte(callStatus, this.callStatus);
    }

    @Override
    public int getLength() {
        return LENGTH;
    }

}
